package com.ftg.learn.bus.basicinfo_record.controller;

import com.ftg.learn.bus.basicinfo_record.entity.BasicinfoRecord;
import com.ftg.learn.bus.basicinfo_record.service.BasicInfoRecordService;
import com.ftg.learn.bus.util.ResultType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Api(value = "基础操作记录",tags = "基础操作记录")
public class BasicInfoRecordController {

    @Autowired
    BasicInfoRecordService birs;

    @ApiOperation(value = "基础操作记录表")
    @GetMapping("/showbasicrec")
    public List<BasicinfoRecord> showAll(){
        return birs.showAll();
    }

    @ApiOperation(value = "删除单条操作记录")
    @DeleteMapping("/deletebasicrec")
    public int delete(String id){
        return birs.delete(id);
    }

    @ApiOperation(value = "查一条操作记录")
    @PutMapping("/basicrecfindone/{id}")
    public BasicinfoRecord findOne(@ApiParam("基操id") @PathVariable String id){
        return birs.findOne(id);
    }

    @GetMapping("/showbasicrec/modify&limit/{page}&{limit}&{basic_id}&{basic_operater}")
    @ApiOperation("模糊查询与分页")
    public ResultType<BasicinfoRecord> query(@ApiParam("总页数") @PathVariable int page, @ApiParam("每页条数") @PathVariable int limit, @ApiParam("基础操作id") @PathVariable String basic_id, @ApiParam("操作人") @PathVariable String basic_operater) {
        return birs.query(page,limit,basic_id,basic_operater);
    }
}
